#ifndef _BACKDROP_DECAL_H_
#define _BACKDROP_DECAL_H_

#include <string>
#include "math/vec2.h"
#include "ui/ui_sprite.h"

namespace backdrop
{
class Backdrop;

class Decal
{
public:
	enum DECAL_TYPES {
		DECAL_BACKGROUND = 0,
		DECAL_FOREGROUND = 128,
	};

	Decal(backdrop::Backdrop* pBackdrop);
	virtual ~Decal();

	virtual bool			CreateDecal(const std::string& File);
	virtual void			SetPos(const math::Vec2& Pos);
	virtual void			SetSize(const math::Vec2& Size);
	virtual bool			Move(const math::Vec2& Offset);
	virtual bool			Tick(float dt);
	virtual bool			Render();
	bool					HitTest(const math::Vec2& Pos);

	virtual bool			IsForeground() const { return (m_DecalType >= DECAL_FOREGROUND) ? true : false; }
	virtual bool			IsBackground() const { return (m_DecalType < DECAL_FOREGROUND) ? true : false; }
	virtual bool			AffectedByWind() const { return false; }
	virtual bool			WrapX() const { return false; }
	virtual bool			WrapY() const { return false; }

	bool					GetIsVisible() const { return m_IsVisible; }
	const math::Vec2&		GetStartPos() { return m_StartPos; }
	const math::Vec2&		GetPos() { return m_Pos; }
	const math::Vec2&		GetSize() { return m_Size; }
	float					GetParallaxFactor() { return m_ParallaxFactor; }
	const std::string&		GetDecalName() { return m_DecalName; }
	DECAL_TYPES				GetDecalType() const { return m_DecalType; }
	COLOR					GetColor() const { return m_Color; }

	void					SetIsVisible(bool Visible = true) { m_IsVisible = Visible; }
	void					SetParallaxFactor(float f) { m_ParallaxFactor = f; }
	void					SetColor(const COLOR& c) { m_Color = c; }

	virtual std::string		GetTypeText() = 0;
	virtual DECAL_TYPES		GetTypeFromString(const std::string& Type) const = 0;

private:
	void					RenderSprite();
	
protected:
	DECAL_TYPES				m_DecalType;
	backdrop::Backdrop*		m_pBackdrop;
	ui::UISprite			m_Sprite;

private:
	bool					m_IsClipped;
	bool					m_IsVisible;
	std::string				m_DecalName;
	math::Vec2				m_StartPos;
	math::Vec2				m_Pos;
	math::Vec2				m_Size;
	float					m_ParallaxFactor;
	COLOR					m_Color;
};
}

#endif // _BACKDROP_DECAL_H_
